package deployr.core;

public class Option {

	private final String value;

	public Option(String value) {
		this.value = value;
	}

	public int orElse(int i) {
		if (null == value) return i;
		return Integer.parseInt(value);
	}

	public String orElse(String string) {
		if (null == value) return string;
		return value;
	}

	public <T> T orThrow(String message) {
		if (null == value) throw new RuntimeException(message);
		return (T) value;
	}

	public String andConcat(String string) {
		if (null == value || value.isEmpty()) return "";
		return value.concat(string);
	}
	
	@Override
	public String toString() {
		return value;
	}

}
